package com.jxj.controller;

import com.jxj.entity.Resp;
import com.jxj.entity.GenResumeVO;
import com.jxj.entity.gen.TResumeMsg;
import com.jxj.service.ResumeService;
import com.jxj.util.JWTUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author Cambria
 * @creat 2021/8/14 11:03
 */
@Slf4j
@RestController
public class ResumeController {

    @Autowired
    ResumeService resumeService;

    @GetMapping({"/organization/record"})
    Resp<List<TResumeMsg>> getAllResume(@RequestHeader(value = "Authorization") String token) {
        token = token.split(" ")[1];
        int userId = JWTUtil.getUserId(token);
        int orgId = JWTUtil.getOrgId(token);
        log.info("用户{}查询组织{}收到的所有简历" , userId , orgId);

        List<GenResumeVO> genResumeVOS = resumeService.listResumeByOid(orgId);

        return new Resp(HttpStatus.OK , "查询完成" , genResumeVOS);
    }

}
